×

Subscribe to newsletter

subscribe to our weekly newsletter to get notified with latest story and article Subscribe now!




PLC BLOG | FactoryTalk View SE Data logging in MS-SQL
Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


FactoryTalk View SE Data logging in MS-SQL

Microsoft SQL Server (MS-SQL) is database management system. It can be installed on Windows and Linux operating systems and can be accessed through a variety of client tools and programming interfaces. MS-SQL used to store and retrieve data from a database. In industrial PLC and SCADA application we used MS-SQL for storing data of our process like alarm, event, history, tag value, process variable etc. MS-SQL provides data integration, data analysis, data reporting, security, scalability, and high availability, making it suitable for critical applications and process. You can also connect your MS-SQL data base with other software. MS-SQL supports a wide range of programming languages, including SQL, T-SQL, .NET, C#, and Visual Basic.MS SQL is available in Express, Standard, Enterprise, and Developer editions. We use express editions in this article link for download is given below of this article. for more information about factorytalk view datalogging visit link


Factorytalk View SE ODBC database storage

ODBC is Open Database Connectivity, it is used for accessing and write data in different type of DBMS like MySQL, Oracle, and Microsoft SQL Server etc. It was developed by Microsoft to provide a common way for Windows-based applications to access data from a variety of database management systems. With the help of ODBC we can execute functions like connecting to a database, executing SQL statements, fetching results, and managing transactions. ODBC is widely used in the industry two version available 64 bit and 32 bit.

Factorytalk View SE ODBC database storage

Create Database In MS-SQL Server For FactoryTalk View For Data logging

before proceed download and install MS-SQL Server Express edition. It is a free edition of SQL Server, ideal for development and production for desktop, web, and small server applications. if you have any difficulty for installation write a comment below. After installation of MS-SQL Server Express edition follow these steps for creating a database
  • Open SQL Server Management Studio and connect to a SQL Server with name and password(if required) watch above video.
  • In the Object Explorer, right-click on the "Databases" folder and select "New Database".
  • In the "New Database" dialog box, enter a name for the database in the "Database name" field.
  • Click "OK" to create the database.
  • or you can use SQL code to create a new database "CREATE DATABASE plcblogdatalog"; after creating data base in SQL server open FactoryTalk view studio.

create database in MS-SQL server for FactoryTalk View for Datalogging

How To Connect SQL Server In Factorytalk View For Datalogging

open your FactoryTalk view studio and then In FactoryTalk View Studio, in the Explorer window, open the Data Log folder. Right-click the Data Log Models icon, and then select New. now datalog model editor will open your screen we already discuss file set storage format in this article we discuss only sql and ODBC server connectivity with FactoryTalk view studio.for Connecting SQL server to FactoryTalk View Application Data logging select storage format as ODBC data source.

How To Connect SQL server in FactoryTalk View for Datalogging

Factorytalk View ODBC Tables Name

when you select storage format as ODBC data source you see three tables name Tag table, string table and float table. The ODBC format stores data in up to three tables:
  • FactoryTalk view ODBC Float table this is main table all logged value store in this table. It stores analog and digital tag values.
  • FactoryTalk view ODBC String tableit is an optional table used for storing string values. All string data and tag stored in string table.
  • FactoryTalk view ODBC Tag table it stores the tag name. It is also an optional table. Tag names in an index so that they can be referenced using a 2- or 4-byte numeric field.
The ODBC tables are created with the default names TagTable, FloatTable, and StringTable. In the Data Log Models editor, you can change these names before creating the tables, or you can specify the names of different tables but i recommend use name as it is.

factorytalk view ODBC tables name

How To Log Data To ODBC Data Sources In Factorytalk View Se

You can store logged data in an existing ODBC data source, or you can create a new ODBC data source. for creating a new ODBC data source follow these steps

  • Creating a new ODBC data source FactoryTalk view se To create a new ODBC data source, click the browse (...) button next to the ODBC Data Source text box.
  • how to Log data to ODBC data sources in factorytalk view se

  • Select the System Data Source tab. Use an existing DSN or select New to create a new one. For a new DSN(Data Source Name)
  • Select the System Data Source tab

  • Select System Data Source. And click next
  • Select System Data Source

  • select sql server and click next. And next pop window click finish
  • select sql server and click next

  • Enter a Name and Description of your DSN. Select Server (always select server where you create a database). sometimes server not listed so enter manually. And Click Next
  • Enter a Name and Description of your DSN

  • select authentication mode of your DSN. you can choose windows authentication or sql server authentication. Use same credentials as your database server. after click next
  • select authentication mode of your DSN

  • select database which we created beginning of article.(plcblogdatalog). If you not select database than by default it logged data in maser database. Click next and then finish.
  • select database

  • after finising above step test your data source if successfully connected than move to following step otherwise write a comment or send a mail so i can help you.
  • test The DSN configured

  • after successfully test The DSN configured should now be set as the ODBC Data Source select your dsn and click ok.
  • ODBC Data Source select your dsn

  • press create table button for creating table in your database. When commend completed a message will pop up "ODBC table were successfully created".
  • press create table button for creating table

    ODBC backup path for datalog in FactoryTalk view studio

    you can set backup path for your ODBC data source. Select enable ODBC backup path than set absolute or relative path. backup files prevents to loss of any type of data if database server is not reachable or not accessible so the backup file take a backup if required you can restore these data by using backup file.

    ODBC backup path for datalog in FactoryTalk view studio

    Purge Old Records From The Database In Factorytalk View Studio Datalog

    in file management tab help to delete old records from the database using standard relational database tools or SQL queries. You can also set up FactoryTalk View to delete records in the ODBC database after a specified time. select time when you want to delete old record in file management tab.

    purge old records from the database in factorytalk view studio datalog

    Specify When To Store Data In Factorytalk View Studio Datalog

    use log trigger tab to define when data logged into database. you can store data periodically, when specific value occur or on demand. in periodic trigger data store in data base at specific time interval. in on change value store at specific value. On demand data store when particular even come.

    Specify when to store data in factorytalk view studio datalog

    How To add tag in ODBC Data source| FactoryTalk Data Log Model

    Use Tag in Modal Tab to Add Tag in Datalog Model. The Tags In Model Tab To Specify Which Tags Will Be Scanned For Data. A Data Log Model Can Contain Up To 10,000 Tags. Browse Tag And Add To Datalog Model. All Type Of Tag You Can Use For Data Logging.

    how to select data for data logging in factorytalk data log model

    Save ODBC Data Source Factorytalk Data Log Model

    after all setting in data log model press ok and set the component name of datalog model. this component you can use for event, manually or automatic data logging etc.

    set component name of of data log model

    Start Data Logging In FactoryTalk Datalog Model

    to start data logging in factory talkview datalog model you can use command line DataLogOn than data model name as DataLogOn 'plcblog' or right click on datalog model component and click to start.

    Start Data Logging In Factorytalk Datalog Model

    Stop Data Logging In FactoryTalk Datalog Model

    to stop data logging in factory talkview datalog model you can use command line DataLogOFF than data model name as DataLogOFF 'plcblog' or right click on datalog model component and click to STOP.

    Stop Data Logging In Factorytalk Datalog Model

    check your datalogging in ms-sql server

    check your datalogging in ms-sql server

    open miscrosoft sql server management studio and select your database and open your table you see your all three table are created Format for ODBC tag table. Open Float table and following is format of ODBC float and string tables
    • DateAndTime The date and time the tag values were logged.
    • Millitm The millisecond time the tag values were logged.
    • TagIndex The index number for the tag. The tag name that corresponds to this number is listed in the tag name table
    • Val The analog or digital value of the tag.
    • Status Blank if communications are working properly. E in a communication error. S if the tag value is stable. U if the tag is uninitialized.
    • markerInternal tag marker.

    Format for ODBC tag table The following table shows the format for ODBC tag table.
    • TagNameThe tag name as in scada.
    • TagIndexThe index number assigned to the tag name.
    • TagTypewhich type of your tag. 2 if tag is Analog ,3 if tag Digital,4 if tag is String.
    • TagDataType this column helps to find data type of logged data tag. -1 for Integer, 0 for Long, 1 for Float, 2for String

    Share on Facebook Share On Twitter Share on LinkedIn Share on Whatsapp


    Suggested Post


     
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

    comment